home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Shareware
/
IDimager Personal 4.2.0.3
/
setup_IDimager_Personal_V4.exe
/
{app}
/
web
/
handleregister.psc
< prev
next >
Wrap
Text File
|
2008-07-28
|
4KB
|
146 lines
<html>
<head>
<title>Register</title>
<link rel="stylesheet" href="idimager.css" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
%include api.inc %/include
<style>
%include idimager.css %/include
</style>
</head>
<body>
%code
function FullHomePageOffset: WideString;
begin
result := StrTran('%var:Homepage', '\', '/');
if Rightstr(result, 1) = '/' then
result := LeftStr(result, Length(result) - 1);
result := result + ':%var:ServerPort';
if Trim('%var:PageOffset') <> '' then
result := result + '%var:PageOffset';
if RightStr (result, 1) <> '/' then
result := result + '/';
end;
var
ADs: TDBXOMClientDataSet;
AError: String;
begin
if (Request.Params.Values['dfPassword'] = '') or (Request.Params.Values['dfPassword2'] = '') then
begin
Response.Redirect ('%var:PageOffset/register.psc?Help=Please%20enter%20a%20password');
exit;
end;
if (Request.Params.Values['dfPassword'] <> Request.Params.Values['dfPassword2']) then
begin
Response.Redirect ('%var:PageOffset/register.psc?Help=The%20repeated%20password%20does%20not%20match%20the%20first%20password');
exit;
end;
if (Request.Params.Values['dfName'] = '') then
begin
Response.Redirect ('%var:PageOffset/register.psc?Help=Please%20enter%20your%20full%20name');
exit;
end;
if Length(Request.Params.Values['dfUserName']) < 5 then
begin
Response.Redirect ('%var:PageOffset/register.psc?Help=The%20user%20name%20should%20be%20at%20least%205%20characters');
exit;
end;
if (Length(Request.Params.Values['dfEmail']) = 0) or
(Pos('@', Request.Params.Values['dfEmail']) = 0) or
(Pos('.', Request.Params.Values['dfEmail']) = 0)
then
begin
Response.Redirect ('%var:PageOffset/register.psc?Help=Please%20specify%20a%20valid%20email%20address');
exit;
end;
ADs := Catalog.NewDataSet;
ADs.CommandText := 'select * from idUser where idUserName = ''' + Request.Params.Values['dfUserName'] + ''' ';
ADs.Open;
if (not ADs.Eof) then
begin
result := 'This username is already registered. If you didn''t receive a confirmation yet, then please wait for at least 48 hours.';
end
else
begin
// create the user record
ADs.Insert;
ADs.FieldByName('GUID').Value := NewGUID;
ADs.FieldByName('idUserName').Value := Request.Params.Values['dfUserName'];
ADs.FieldByName('idPassword').Value := MD5(Request.Params.Values['dfPassword'], '');
ADs.FieldByName('FullUserName').Value := Request.Params.Values['dfName'];
ADs.FieldByName('EMailAddress').Value := Request.Params.Values['dfEMail'];
ADs.FieldByName('idUserType').Value := 'WEB';
// set as disabled so the administrator can validate the new user
ADs.FieldByName('idProtected').Value := 1;
Result := 'An e-mail is being delivered to ' + Request.Params.Values['dfEMail'];
AError := SendShortEMail (
'%var:SMTPHost',
'%var:AdminEMail',
Request.Params.Values['dfEMail'],
'',
'',
'Your registration at %var:Homepage',
'Thank you for registering at <b>%var:Homepage</b><p>Your access request will be evaluated a.s.a.p.</p><p>Kind regards</p>'
);
if AError <> '' then
result := result + '<p>ERROR: ' + AError
else
begin
// send a message to the administrator for evaluating the request
AError := SendShortEMail (
'%var:SMTPHost',
'%var:AdminEMail',
'%var:AdminEMail',
'',
'',
Request.Params.Values['dfName'] + ' requests access to %var:Homepage',
'Hello,<p>' +
Request.Params.Values['dfName'] + ' requests access to %var:Homepage. The supplied reason is<p>' +
'<hr>' + Request.Params.Values['mmWhoAreYou'] + '<hr></p>' +
'<p>Click <a href="' + FullHomePageOffset + 'validateregister.psc?GUID=' + ADs.FieldByName('GUID').Value + '">here</a> to validate the request'
);
end;
if AError = '' then
ADs.UpdateBatch ('idUser', 'GUID', arAll);
end;
ADs.Close;
ADs.Free;
end;
%/code
</body>
</html>